﻿using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using System;
using System.Collections.Generic;
using System.Text;

namespace Helpers.Options
{
    public class FirefoxConfig
    {
        public FirefoxConfig()
        {
            UseProfile = false;
        }
        /// <summary>
        /// 默认驱动开关，默认关
        /// </summary>
        public bool UseDriver { get; set; } = false;
        /// <summary>
        /// 驱动路径
        /// </summary>
        public string DriverPath { get; set; }
        public string DriverName { get; set; } = "geckodriver.exe";
        /// <summary>
        /// 无头开关，默认关
        /// </summary>
        public bool UseHeadless { get; set; } = false;
        /// <summary>
        /// 图片开关，默认开
        /// </summary>
        public bool ShowImage { get; set; } = true;
        public bool UseRandomUserAgent { get; set; } = false;
        public string UserAgent { get; set; } = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:58.0) Gecko/20100101 Firefox/58.0";
        public bool _UseProfile;
        /// <summary>
        /// 用户配置，默认关
        /// </summary>
        public bool UseProfile
        {
            get => _UseProfile;
            set
            {
                AutoDelete = !value;
                _UseProfile = value;
            }
        }
        /// <summary>
        /// 用户配置路径
        /// </summary>
        public string ProfilePath { get; set; }
        /// <summary>
        /// 浏览器开关，默认关
        /// </summary>
        public bool UseBrowser { get; set; } = false;
        /// <summary>
        /// 浏览器路径
        /// </summary>
        public string BrowserPath { get; set; }
        public bool HideCommandPromptWindow { get; set; } = false;

        /// <summary>
        /// 会把原配置文件删除,需要把AutoDelete设置为false
        /// </summary>
        public bool UseProxy { get; set; } = false;
        
        public bool AutoDelete { get; set; } = true;
        public Proxy proxy { get; set; }

        /// <summary>
        /// 日志等级
        /// </summary>
        public FirefoxDriverLogLevel LogLevel { get; set; } = FirefoxDriverLogLevel.Trace;

        public TimeSpan CommandTimeout { get; set; } = TimeSpan.FromMinutes(3);
    }
}
